const http = (obj) => {
	/* 
		obj={
			url,mehtod,data.header
		}
	 */
	return new Promise((resolve, reject) => {
		uni.request({
			// #ifndef MP-WEIXIN 
			url: '/api' + obj.url,
			// #endif
			// #ifdef MP-WEIXIN
			url: 'http://localhost:3000' + obj.url,
			// #endif
			method: obj.method || 'GET',
			data: obj.data || {},
			header: obj.header || {
				'content-type': 'application/json'
			},
			success(res) {
				resolve(res)
			},
			fail(error) {
				reject(error)
			}
		})
	});
}
export default http